/*!
 * tykhome - sign.js
 * Author tykhome <yongketian@gmail.com>
 */

/**
 * Module dependencies.
 */
var express = require('express');
var router = express.Router();

var config = require('../config/config');
var securePort = process.env.SECURE_PORT || config.app.securePort;
var forceSecure = require('../middlewares/httpsRedirect').forceSecure(securePort);
var auth = require('../middlewares/auth');
var sign = require('../controllers/sign');

// ===============================
// ========Sign Controller========
// ===============================
// signin
router.get('/signin', auth.canNotSignin, forceSecure, sign.showLogin);
router.post('/signin', auth.canNotSignin, forceSecure, sign.login);

router.get('/signout', auth.signinRequired, sign.signout);

module.exports = router;